//组合继承
function Parent(name){
    this.name=name;
    this.colors=['red','blue','yellow']
}
Parent.prototype.getName=function(){
    console.log(this.name)
}
function Child(name,age){
    Parent.call(this,name);
    this.age=age;
}
Child.prototype=new Parent();//继承原型属性
Child.prototype.constructor=Parent;
var child1=new Child('wangwu',11);
child1.colors.push('black');
console.log(child1.name); 
console.log(child1.age); 
console.log(child1.colors); // ["red", "blue", "green", "black"]
var child2=new Child('zhang',22)
console.log(child2.name); 
console.log(child2.age); 
console.log(child2.colors);
